<template>
  <div>
    <el-menu
      class="el-menu-demo"
      mode="horizontal"
      background-color="#eee"
      text-color="#000"
      active-text-color="#000"
      @select="handleSelect">
      <el-menu-item :index="summary">课程首页</el-menu-item>
      <el-menu-item :index="baseinfo">基本信息</el-menu-item>
      <el-menu-item :index="picture">课程图片</el-menu-item>
      <el-menu-item :index="marketinfo">课程营销</el-menu-item>
      <el-menu-item :index="plan">课程计划</el-menu-item>
      <el-menu-item :index="teacher">教师信息</el-menu-item>
      <el-menu-item :index="pub">发布课程</el-menu-item>
        <el-button icon="el-icon-back"  class="goback" @click="goback">返回</el-button>
    </el-menu>
    <router-view class="main"></router-view>
  </div>
</template>
<script>
  export default {
    data() {
      return {
        courseid: '',
        summary: '',
        baseinfo: '',
        picture: '',
        marketinfo: '',
        plan: '',
        teacher: '',
        pub: '',
        size: '',
        currentPage: ''
      }
    },
    methods: {
      handleSelect(key, keyPath) {
        this.$router.push({path: key})
      },
      goback() {
        this.$router.push({path: '/course/list',
          query: {
            size: this.size,
            currentPage: this.currentPage
          }
        })
      }
    },
    mounted() {
      this.size = this.$route.query.size;
      this.currentPage = this.$route.query.currentPage;
      this.courseid = this.$route.params.courseid;
      this.summary = '/course/manage/summary/' + this.courseid;
      this.baseinfo = '/course/manage/baseinfo/' + this.courseid;
      this.picture = '/course/manage/picture/' + this.courseid;
      this.marketinfo = '/course/manage/marketinfo/' + this.courseid;
      this.plan = '/course/manage/plan/' + this.courseid;
      this.teacher = '/course/manage/teacher/' + this.courseid;
      this.pub = '/course/manage/pub/' + this.courseid;
      //跳转到课程基本信息
      this.$router.push({path: '/course/manage/baseinfo/' + this.courseid})
    }
  }
</script>
<style scoped>
  .goback {
    margin: 10px;
  }

</style>
